package com.cloud.screen.interfaces;

import com.cloud.screen.common.config.FeignConfiguration;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @program: quokka-server
 * @description: ${description}
 * @author: sl
 * @create: 2019-07-04 15:49
 **/
@FeignClient(value = "FORCE", configuration = FeignConfiguration.class, fallbackFactory = FeignClientForceFallbackFactory.class)
public interface FeignClientForce {

    /**
     * 案件指数
     * @param start
     * @param end
     * @param unitCode
     * @param type
     * @param recType
     * @return
     */
    @RequestMapping(value = "force/interface/getRecForceByDate", method = RequestMethod.GET)
    List<Map<String, Object>> getRecForceByDate(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("type") Integer type, @RequestParam("recType") Integer recType);

    /**
     * 案件来源
     *
     * @return
     */
    @RequestMapping(value = "force/interface/getLegalCaseSource", method = RequestMethod.GET)
    List<Map<String, Object>> getLegalCaseSource(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("recType") Integer recType);
    /**
     * 案件区域分布
     *
     * @param start
     * @param end
     * @param unitCode
     * @param recType
     * @return
     */
    @RequestMapping(value = "force/interface/getLegalCaseRegion", method = RequestMethod.GET)
    List<Map<String, Object>> getLegalCaseRegion(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode,@RequestParam("regionCode") String regionCode, @RequestParam("recType") Integer recType);

    /**
     * top5
     * @param start
     * @param end
     * @param unitCode
     * @param recType
     * @return
     */
    @RequestMapping(value = "force/interface/getLegalCaseDomain", method = RequestMethod.GET)
    List<Map<String,Object>> getLegalCaseDomain(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("recType") Integer recType, @RequestParam("num") Integer num);

    /**
     * 首页悬浮栏
     * @param start
     * @param end
     * @return
     */
    @RequestMapping(value = "force/interface/getLegalCaseGeneral", method = RequestMethod.GET)
    Map<String,Object> getLegalCaseGeneral(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode);

    /**
     * 法律法规top5
     * @return
     */
    @RequestMapping(value = "force/interface/getLawCaseTop5", method = RequestMethod.GET)
    List<Map<String,Object>> getLawCaseTop5(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("recType") Integer recType);

    /**
     * 法律法规top5
     * @return
     */
    @RequestMapping(value = "force/interface/getLawCaseTop", method = RequestMethod.GET)
    List<Map<String,Object>> getLawCaseTop(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("num") Integer num);

    /**
     * 根据regionCode查询所有已有违法事实的行政强制
     * @param unitCode
     * @param regionid
     * @return
     */
    @RequestMapping(value = "force/interface/getBasisCodeByRegionCode", method = RequestMethod.GET)
    List<Map<String,Object>> getBasisCodeByRegionCode(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode")String unitCode, @RequestParam("regionid")Long regionid);


    /**
     * 法律法规使用统计
     * @return
     */
    @RequestMapping(value = "force/interface/getLawUseStat", method = RequestMethod.GET)
    List<Map<String,Object>> getLawUseStat(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode);

    /**
     * 行政处罚案由使用统计
     * @return
     */
    @RequestMapping(value = "force/interface/getCauseUseStat", method = RequestMethod.GET)
    List<Map<String, Object>> getCauseUseStat(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode, @RequestParam("lawID") String lawID);

    /**
     * 强制 部门 数量
     * @return
     */
    @RequestMapping(value = "force/interface/getForceByRegionId", method = RequestMethod.GET)
    List<Map<String,Object>> getForceByRegionId(@RequestParam("start") String start, @RequestParam("end") String end, @RequestParam("unitCode") String unitCode,@RequestParam("recType") Integer recType);
}
@Component
class FeignClientForceFallbackFactory implements FallbackFactory<FeignClientForce> {
    private static final Logger LOGGER = LoggerFactory.getLogger(FeignClientForceFallbackFactory.class);

    @Override
    public FeignClientForce create(final Throwable cause) {
        return new FeignClientForce() {

            @Override
            public List<Map<String, Object>> getRecForceByDate(String start, String end, String unitCode, Integer type,Integer recType) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLegalCaseSource(String start, String end, String unitCode,Integer recType) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLegalCaseRegion(String start, String end, String unitCode,String regionCode, Integer recType) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLegalCaseDomain(String start, String end, String unitCode, Integer recType, Integer num) {
                return null;
            }

            @Override
            public Map<String, Object> getLegalCaseGeneral(String start, String end, String unitCode) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLawCaseTop5(String start, String end, String unitCode, Integer recType) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLawCaseTop(String start, String end, String unitCode, Integer num) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getBasisCodeByRegionCode(String start, String end,String unitCode, Long regionid) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLawUseStat(String start, String end, String unitCode) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getCauseUseStat(String start, String end, String unitCode, String lawID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getForceByRegionId(String start, String end, String unitCode,Integer recType) {
                return null;
            }
        };
    }

}
